<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:crm="http://www.thymeleaf.org/crm"
	xmlns:dt="http://github.com/dandelion/datatables">

<head th:replace="fragment/common :: header"></head>
<body>

	<div th:replace="fragment/common :: topnav"></div>

	<div id="wrap">

		<div class="container-fluid">

			<div class="row">
				<div class="span8">
					<h4>New Contact</h4>
				</div>
				<div class="span4 pull-right">
					<div class="btn-group pull-right">
						<a class="btn btn-primary" href="list"> <i
							class="fa fa-plus-square"></i> View Accounts
						</a>
						<button class="btn btn-warning">
							<i class="fa fa-upload"></i> Import Accounts
						</button>

					</div>
				</div>
			</div>


			<form th:action="${id == null} ? @{/account/save} : @{/account/update}"
				method="POST" th:object="${account}">
				<input type="hidden" th:field="*{id}" />
				<div class="row-fluid">


					<div class="span12">

						<div class="alert alert-success" th:if="${message != null}">
							<button type="button" class="close" data-dismiss="alert">&times;</button>
							<b>Success!</b>
							Account saved successfully.
						</div>

						<fieldset>

							<div class="row-fluid">

								

								<!--/span-->
								<div class="span4"
									th:class="${#fields.hasErrors('name') ? 'span4 control-group error' : 'span4'}">
									<label> Name</label> <input type="text" class="span12"
										th:field="*{name}" />

									<p class="alert alert-error"
										th:if="${#fields.hasErrors('name')}"
										th:errors="*{name}">Cannot be empty</p>

								</div>
								<!--/span-->

								<div class="span4">
									<label>Parent</label> 
									<input type="text" class="span12"
										th:field="*{parent.name}" />
									
									<input type="hidden" class="span12"
										th:field="*{parent.id}" />
										
										
								</div>

							</div>

							<div class="row-fluid">

								
								<!--/span-->

								<div class="span4">
									<label>Type</label> <input type="text" class="span12"
										th:field="*{title}" />
								</div>
								<!--/span-->

								<div class="span4">
									<label>Industry</label> <select th:field="*{industry}">
										<option th:each="s : ${industries}" th:value="${s}"
											th:text="#{${s}}"></option>
									</select>
								</div>
								<!--/span-->


							</div>
							
							<div class="row-fluid">

								
								<!--/span-->

								<div class="span4">
									<label>Annual Revenue</label> <input type="text" class="span12"
										th:field="*{annualRevenue}" />
								</div>
								<!--/span-->

								<div class="span4">
									<label>Rating</label> <input type="text" class="span12"
										th:field="*{rating}" />
								</div>
								<!--/span-->


							</div>
							
							<div class="row-fluid">

								
								<!--/span-->

								<div class="span4">
									<label>Stock Quote</label> <input type="text" class="span12"
										th:field="*{stockQuote}" />
								</div>
								<!--/span-->

								<div class="span4">
									<label>Website</label> <input type="text" class="span12"
										th:field="*{website}" />
								</div>
								<!--/span-->


							</div>
							
							<div class="row-fluid">

								
								<div class="span4">
									<label>Phone</label> <input type="text" class="span12"
										th:field="*{phone}" />
								</div>
								<!--/span-->

								<div class="span4">
									<label>Other Phone</label> <input type="text" class="span12"
										th:field="*{otherPhone}" />
								</div>
								<!--/span-->
								
								<div class="span4">
									<label>Fax</label> <input type="text" class="span12"
										th:field="*{fax}" />
								</div>
								<!--/span-->


							</div>
							

							<div class="row-fluid">


								<div class="span4"
									th:class="${#fields.hasErrors('email') ? 'span4 control-group error' : 'span4'}">
									<label>Email</label> <input type="text" class="span12"
										th:field="*{email}" />

									<p class="alert alert-error"
										th:if="${#fields.hasErrors('email')}" th:errors="*{email}">Cannot
										be empty</p>

								</div>
								<!--/span-->


								<div class="span4"
									th:class="${#fields.hasErrors('alternateEmail') ? 'span4 control-group error' : 'span4'}">
									<label>Alternate Email</label> <input type="text"
										class="span12" th:field="*{alternateEmail}" />

									<p class="alert alert-error"
										th:if="${#fields.hasErrors('alternateEmail')}"
										th:errors="*{alternateEmail}">Cannot be empty</p>
								</div>
								
								
								


							</div>
							
							

						</fieldset>

						<fieldset>
							

							<div class="row-fluid">
								<textarea rows="3" cols="30" th:field="*{mailing.street}" class="span6"
									placeholder="Street"> </textarea>


							</div>



							<div class="row-fluid">

								<input type="text" class="span6" th:field="*{mailing.city}"
									placeholder="City" /> 
									
								<input type="text" class="span6"
									th:field="*{mailing.state}" placeholder="State" />


							</div>
							<!--/row-->
							<div class="row-fluid">
								<input type="text" class="span6" th:field="*{mailing.postCode}"
									placeholder="Post Code" /> 
								
								<input type="text" class="span6"
									th:field="*{mailing.country}" placeholder="Country" />

							</div>
							<!--/row-->
						</fieldset>
						
						<fieldset>
							<legend>Billing Address</legend>

							<div class="row-fluid">
								<textarea rows="3" cols="30" th:field="*{billing.street}" class="span6"
									placeholder="Street"> </textarea>


							</div>



							<div class="row-fluid">

								<input type="text" class="span6" th:field="*{billing.city}"
									placeholder="City" /> 
									
								<input type="text" class="span6"
									th:field="*{billing.state}" placeholder="State" />


							</div>
							<!--/row-->
							<div class="row-fluid">
								<input type="text" class="span6" th:field="*{billing.postCode}"
									placeholder="Post Code" /> 
								
								<input type="text" class="span6"
									th:field="*{billing.country}" placeholder="Country" />

							</div>
							<!--/row-->
						</fieldset>
						
					</div>
					<!--/span-->


					<!--/span-->
				</div>
				<!--/row-->
				<div class="row-fluid  pull-right">


					<div class="form-actions">
						<button type="submit" class="btn btn-primary">Save</button>
						<button type="button" class="btn">Cancel</button>
					</div>



				</div>
			</form>


		</div>


		<div id="push"></div>
	</div>




</body>
</html>